package com.graduation.lastproject.service.home.HomeHighActice.impl;

import com.graduation.lastproject.dao.home.HomeHighDao;
import com.graduation.lastproject.entity.*;
import com.graduation.lastproject.service.home.HomeHighActice.HomeHighService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class IHomeHighService implements HomeHighService {

    @Autowired
    private HomeHighDao homeHighDao;
    @Override
    public List<Bookorder> getAllBookorder(String myPhone) {
        return homeHighDao.getALLBookorder(myPhone);
    }

    @Override
    public int deleteOrderById(String id) {
        return homeHighDao.deleteOrderById(id);
    }

    @Override
    public int insertReview(Map<String, Object> map) {
        return homeHighDao.insertReview(map);
    }

    @Override
    public List<Review> getAllReview(String myPhone) {
        return homeHighDao.getAllReview(myPhone);
    }

    @Override
    public int deleteReviewById(String id) {
        return homeHighDao.deleteReviewById(id);
    }

    @Override
    public int reviewAdd(Map<String, Object> map) {
        /*追评 更新评论时间、评论内容  不再新建追评内容、追评时间字段*/
        SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
        map.put("reviewTime",dateFormat.format(new Date()));
        return homeHighDao.reviewAdd(map);
    }

    @Override
    public List<Commodity> getCommodityList(int state) {
        return homeHighDao.getALLCommodity(state);
    }

    @Override
    public int insertExchangeOrder(Map<String, Object> map) {
        return homeHighDao.insertExchangeOrder(map);
    }

    @Override
    public List<Commodityorder> getAllComorder(String id) {
        return homeHighDao.getALLComorder(id);
    }

    @Override
    public int deleteMycommodityOrderById(String id) {
        return homeHighDao.deleteMycommodityOrderById(id);
    }

    @Override
    public int getInMycommodityOrderById(String id) {
        return homeHighDao.getInMycommodityOrderById(id);
    }

    @Override
    public User getUserInfo(String id) {
        return homeHighDao.getUserInfo(id);
    }
}
